package core.bmp.model;

/**
 * Bmp图像的数据模型。后续的图片处理只需要这么多数据就够了。
 * 
 * @author 陈锡强
 * @since 2015年11月23日08:48:06
 */
public class BmpData implements Cloneable {
	
	private int width;
	private int height;
	private int colorBit;
	private int[] argbPix;
	
	public BmpData(int width, int height, int colorBit, int[] argbPix) {
		super();
		this.width = width;
		this.height = height;
		this.colorBit = colorBit;
		this.argbPix = argbPix;
	}
	
	public int getWidth() {
		return width;
	}
	
	public int getHeight() {
		return height;
	}
	
	public int getColorBit() {
		return colorBit;
	}
	
	public int[] getArgbPix() {
		return argbPix;
	}
	
	public void setArgbPix(int[] argbPix) {
		this.argbPix = argbPix;
	}
	
	@Override
	public BmpData clone() throws CloneNotSupportedException {
		BmpData bmpData = (BmpData) super.clone();
		// 这里只对数据进行深拷贝
		int len = argbPix.length;
		bmpData.argbPix = new int[len];
		for (int i = 0; i < len; i++) {
			bmpData.argbPix[i] = argbPix[i];
		}
		return bmpData;
	}
}
